package com.ruoyi.common.enums;
/**
 * 是否枚举
 *
 * @author zqf
 */
public enum WhetherEnum {
    YES(1, "是", true),
    NO(0, "否", false);
    private Integer code;
    private String desc;
    private boolean isDefault;
    WhetherEnum(Integer code, String desc, boolean isDefault) {
        this.code = code;
        this.desc = desc;
        this.isDefault = isDefault;
    }
    public Integer getCode() {
        return code;
    }
    public String getDesc() {
        return desc;
    }
    public boolean isDefault() {
        return isDefault;
    }
    public static WhetherEnum getEnum(Integer code) {
        for (WhetherEnum e : values())
            if (e.getCode().equals(code))
                return e;
        return null;
    }
    public static WhetherEnum getEnum(boolean isDefault) {
        for (WhetherEnum e : values())
            if (e.isDefault()==(isDefault))
                return e;
        return null;
    }


}
